//导入Vue
import Vue from 'vue';
import VueRouter from 'vue-router';

Vue.use(VueRouter);

//移动端
import Mobile from '@/view/Mobile.vue';
import MobileHome from '@/view/mobile/MobileHome.vue';
import MobileHeader from '@/components/mobile/default/MobileHeader.vue';
import MobileFooter from '@/components/mobile/default/MobileFooter.vue';
import BookList from '@/view/mobile/BookList.vue';
// import Setup from '@/view/mobile/Setup.vue';
import MobileMy from '@/view/mobile/MobileMy.vue';
import MobileBooksDetail from '@/view/mobile/MobileBooksDetail.vue';
import MoblieSearch from '@/view/mobile/MoblieSearch.vue';
import MyCart from '@/components/MyMobile/MyCart.vue';
import MyCartTwo from '@/components/MyMobile/MyCartTwo.vue';
import Mypayment from '@/components/MyMobile/Mypayment.vue';
import MyOrders from '@/components/MyMobile/MyOrders.vue';
import Home from '@/view/pc/Home.vue';
import MobileLogin from '@/view/mobile/MobileLogin.vue';

// pc端
import HotPic from '@/components/pc/movie/HotPic.vue';
import Moviegenre from '@/components/pc/movie/Moviegenre.vue';
import Moviegenre2 from '@/components/pc/movie/Moviegenre2.vue';
import MoviegList from '@/components/pc/movie/MoviegList.vue';
import Orders from '@/components/pc/movie/Orders.vue';
import Administrator from '@/components/pc/adm/Administrator';
import Admpersona from '@/components/pc/adm/Admpersona';

import UpdateMovList from '@/components/pc/update/UpdateMovList.vue';
import UpdateHotPic from '@/components/pc/update/UpdateHotPic.vue';
import AddMovList from '@/components/pc/add/AddMovList.vue';
import AddHotPic from '@/components/pc/add/AddHotPic.vue';

//pc端书城
import pcHome from '@/components/pcbook/pcview/pcHome.vue';
import PCBody from '@/components/pcbook/pcview/PCBody.vue';
import PCUser from '@/components/pcbook/pcview/PCUser.vue';
import Updatepwd from '@/components/pcbook/pcview/User/Updatepwd.vue';
import Updatepic from '@/components/pcbook/pcview/User/Updatepic.vue';
import UpdateUsr from '@/components/pcbook/pcview/User/UpdateUsr.vue';
import PCbooklist from '@/components/pcbook/pcview/PCbooklist.vue';
import Header from '@/components/pcbook/pcdefault/Header.vue';
import PCFooter from '@/components/pcbook/pcdefault/PCFooter.vue';
import PCLogin from '@/components/pcbook/pclogin/PCLogin.vue';
import PCEnroll from '@/components/pcbook/pclogin/PCEnroll.vue';
import PCCart from '@/components/pcbook/pcshop/PCCart.vue';
import PCOrders from '@/components/pcbook/pcshop/PCOrders.vue';
import PCpayment from '@/components/pcbook/pcshop/PCpayment.vue';
import PCpar2 from '@/components/pcbook/pcshop/PCpar2.vue';
import PCBooksDeta from '@/components/pcbook/Subassemblies/PCBooksDeta.vue';


const routes = [{
		path: '/',
		// redirect : {
		// 	name : 'Home'
		// }
		redirect: '/moblie/home'
	},
	{
		path: '/home',
		name: 'Home',
		component: Home,
	},
	{
		path: '/moblie',
		name: 'Mobile',
		component: Mobile,
		//子路由不要携带斜杠！！！有斜杠是渲染失败的
		children: [{
				path: 'home',
				name: 'MobileHome',
				//下面所使用的是 命名试图的方式，为router-view的name属性匹配组件
				components: {
					default: MobileHome, //渲染到没有name属性的router-view上
					header: MobileHeader,
					footer: MobileFooter
				}
			},
			{
				path: 'booklist',
				name: 'BookList',
				components: {
					default: BookList, //渲染到没有name属性的router-view上
					header: MobileHeader,
					footer: MobileFooter
				}
			},
			// {
			// 	path : 'setup',
			// 	name : 'Setup',
			// 	componenet :Setup
			// },
			{
				path: 'mysecret',
				name: 'MobileMy',
				component: MobileMy
			},
			{
				path: 'bookdetail/:bookid',
				name: 'MobileBooksDetail',
				component: MobileBooksDetail
			},
			{
				path: 'search',
				name: 'MoblieSearch',
				component: MoblieSearch
			},
			{
				path: 'mycart',
				name: 'MyCart',
				component: MyCart
			},
			{
				path : 'mycarttwo',
				name : 'MyCartTwo',
				component :MyCartTwo
			},
			{
				path : 'mypayment',
				name : 'Mypayment',
				component : Mypayment
			},
			{
				path: 'myorders',
				name: 'MyOrders',
				component: MyOrders
			},
			{
				path: '/login',
				name: 'MobileLogin',
				component: MobileLogin
			},
		]
	},
	{
		path: '/home',
		component: Home,
		meta: {
			title: '后台管理系统首页'
		},
		children: [{
				path: '/',
				redirect: {
					name: 'Moviegenre'
				}
			},
			{
				path: 'administrator',
				name: 'Administrator',
				meta: {
					title: '管理员列表'
				},
				component: Administrator,
			},
			{
				path: 'admpersona',
				name: 'Admpersona',
				meta: {
					title: '角色列表'
				},
				component: Admpersona,
			},
			{
				path: 'hotpic',
				name: 'HotPic',
				meta: {
					title: '热点图片'
				},
				component: HotPic,
			},
			{
				path: 'moviegenre',
				name: 'Moviegenre',
				meta: {
					title: '书籍类型'
				},
				component: Moviegenre,
			},
			{
				path: 'moviegenre2',
				name: 'Moviegenre2',
				meta: {
					title: '书籍类型二'
				},
				component: Moviegenre2,
			},
			{
				path: 'order',
				name: 'Orders',
				meta: {
					title: '订单页'
				},
				component: Orders,
			},
			{
				path: 'list',
				name: 'MoviegList',
				meta: {
					title: '商品列表'
				},
				component: MoviegList,
			},
			{
				path: 'uphotpic',
				name: 'UpdateHotPic',
				meta: {
					title: '修改热点图片信息'
				},
				component: UpdateHotPic,
			},
			{
				path: 'updatelist',
				name: 'UpdateMovList',
				meta: {
					title: '修改书籍信息'
				},
				component: UpdateMovList,
			},
			{
				path: 'addhotpic',
				name: 'AddHotpic',
				meta: {
					title: '添加热点图片'
				},
				component: AddHotPic,
			},
			{
				path: 'addmovlist',
				name: 'AddMovList',
				meta: {
					title: '添加书籍'
				},
				component: AddMovList,
			},
		]
	},
	{
		path: '/pc',
		name: 'pcHome',
		component : pcHome,
		children:[
			{
				path :'pchome',
				name : 'PCBody',
				components : {
					default : PCBody,
					header : Header,
					footer : PCFooter,
				}
			},
			{
				path : 'login',
				name : 'PCLogin',
				component : PCLogin
			},
			{
				path : 'user',
				name :'PCUser' ,
				component : PCUser
			},
			{
				path : 'uppwd',
				name : 'Updatepwd',
				component :Updatepwd
			},
			{
				path : 'uppic',
				name : 'Updatepic',
				component : Updatepic
			},
			{
				path : 'upusr',
				name: 'UpdateUsr',
				component:UpdateUsr
			},
			{
				path : 'enroll',
				name : 'PCEnroll',
				components : {
					default : PCEnroll,
					header : Header
				}
			},
			{
				path : 'cart',
				name : 'PCCart',
				components : {
					default : PCCart,
					header : Header
				}
			},
			{
				path : 'order',
				name : 'PCOrders',
				component : PCOrders
			},
			{
				path : 'par2',
				name : 'PCpar2',
				components : {
					default : PCpar2,
					header : Header,
				}
			},
			{
				path : 'payment',
				name : 'PCpayment',
				components : {
					default :PCpayment,
					header : Header
				}
			},
			{
				path:'booklist',
				name :'PCbooklist',
				components:{
					header : Header,
					default: PCbooklist
				}
			},
			{
				path : 'booksdeta',
				name : 'PCBooksDeta',
				components :{
					header : Header,
					default: PCBooksDeta
				}
			}
		]
	},
];



const router = new VueRouter({
	routes,
})

export default router;